<!DOCTYPE html>
<html lang="zh-CN">
 <head> 
  <meta charset="utf-8" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1" /> 
  <title>${(website_name)!}</title> 
  <!-- Bootstrap --> 
  <!-- 新 Bootstrap 核心 CSS 文件 --> 
  <link rel="stylesheet" href="${base}/res/bootstrap/css/bootstrap.min.css" /> 
  <!-- 可选的Bootstrap主题文件（一般不用引入） --> 
  <link rel="stylesheet" href="${base}/res/bootstrap/css/bootstrap-theme.min.css" /> 
  <!-- 自定义的css文件 --> 
  <link rel="stylesheet" href="${base}/res/tb/css/style.css" /> 
  <!-- 网站favicon图标 -->
  <link rel="shortcut icon" href="${base}/favicon.ico"/>
  <link rel="bookmark" href="${base}/favicon.ico"/>
  <!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> 
  <script src="${base}/res/tb/js/jquery.min.js"></script> 
  <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> 
  <script src="${base}/res/bootstrap/js/bootstrap.min.js"></script> 
  <!-- 点触验证码 -->
  <script type="text/javascript" charset="utf-8" src="http://js.touclick.com/js.touclick?b=6d4099c0-2975-4da2-bf25-a5ee693731fa&pf=api&v=v2-2"></script>
 </head> 
 <body> 
  <nav class="navbar navbar-default"> 
   <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display --> 
    <div class="navbar-header"> 
     <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> 
     <a class="navbar-brand" href="${home}"><span class="glyphicon glyphicon-cloud"></span> ${(website_name)!}</a> 
    </div> 
    <!-- Collect the nav links, forms, and other content for toggling --> 
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
     <ul class="nav navbar-nav"> 
      <li><a href="${home}"><span class="glyphicon glyphicon-play"></span> 登陆 </a></li> 
      <li class="active"><a href="${base}/user/reg"><span class="glyphicon glyphicon-user"></span> 注册 </a></li> 
      <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> 关于 <span class="caret"></span></a> 
       <ul class="dropdown-menu"> 
        <li><a href="http://iicm.me" target="_blank">iicm的博客</a></li> 
       </ul></li> 
     </ul> 
    </div>
    <!-- /.navbar-collapse --> 
   </div>
  </nav> 
  <div class="container bs-docs-container" style="margin-top: 10%"> 
   <div class="row"> 
    <div class="col-md-4"> 
    </div> 
    <div class="col-md-4" role="main"> 
     <div class="panel panel-success" style="margin: 1% 1% 1% 1%;"> 
      <div class="panel-heading"> 
       <h1 class="panel-title">注册TieBa Cloud Sign</h1> 
      </div> 
      <div style="margin:0% 5% 5% 5%;"> 
       <div class="login-top"></div>
       <br />
       <br /> 
       <#if status?? && status != 0>
        <div class="alert alert-danger alert-dismissable">
         <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    错误：${message}
        </div>
       </#if>
       <form action="${base}/user/register" method="post" onsubmit="return tou_submit.call(this)"> 
        <div class="input-group"> 
         <span class="input-group-addon">用户名</span> 
         <input type="text" class="form-control" name="userName" placeholder="请输入用户名或邮箱" value="${userName}" required /> 
        </div> 
        <br /> 
        <div class="input-group"> 
         <span class="input-group-addon">密码</span> 
         <input type="password" class="form-control" name="password" placeholder="请输入密码" value="${password}" required /> 
        </div> 
        <br /> 
        <div class="input-group"> 
         <span class="input-group-addon">邮箱</span> 
         <input type="text" class="form-control" name="email" placeholder="请输入邮箱" value="${email}" required /> 
        </div> 
        <br />
       <!--  <div class="input-group"> 
         <input class="form-control" name="captcha" type="text" placeholder="请输入验证码" style="width: 40%;display: inline;" /> &nbsp;&nbsp;
         <img id="captchaImage" src="${base}/user/captcha" onclick="refreshCaptcha();" /> &nbsp;
         <button class="btn btn-default" type="button" onclick="refreshCaptcha();">刷新</button> 
        </div> --> 
        <#if isInvite?? && isInvite>
	     <div class="input-group"> 
	      <span class="input-group-addon">邀请码</span> 
	      <input type="text" class="form-control" name="inviteCode" placeholder="请输入邀请码" value="${(inviteCode)!}" required /> 
	     </div>
        </#if>
	     <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=359916450&site=sign.iicm.me&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:359916450:52" alt="点击这里获取邀请码" title="点击这里获取邀请码"/>获取邀请码</a>
        <div class="login-button">
         <br />
         <br /> 
         <button type="submit" class="btn btn-success" style="width:100%;float:left;">注册</button> 
        </div>
        <br />
        <br />
        <div style=" clear:both;"></div> 
       </form> 
      </div> 
     </div> 
    </div> 
   </div> 
  </div>  
  <script type="text/javascript">
  /* 	$(document).ready(function () {
		$('ul.nav > li').click(function (e) {
		e.preventDefault();
		$('ul.nav > li').removeClass('active');
		$(this).addClass('active');
	  });
	}); */
	/* function refreshCaptcha(){
		document.getElementById("captchaImage").src = "${base}/user/captcha?rnd=" + Math.random();
	} */
	var is_checked = false; //表示是否验证成功
    function tou_submit()
    {
        if (is_checked === true)
        {
            return true;
        }
        else
        {
            window.TouClick.Start({
                website_key: '6d4099c0-2975-4da2-bf25-a5ee693731fa',
                position_code: 0,//位置标记(范围：10<position_code<100 ,如不在此范围内,则为0)
                args: { 'this_form': this },
				//事件onInit、onLoading、onLoaded、onSuccess、onFail、onError 的共有第一参数
                captcha_style: { },//设置验证码外框的css样式
                onSuccess: function (args, check_obj)
                {
				//check_obj = {'check_key':'','check_address':''} 二次验证口令check_key与二次验证地址check_address
                    is_checked = true;
                    //获取form对象
                    var this_form = args.this_form;
                    var hidden_input_key = document.createElement('input');
                    hidden_input_key.name = 'check_key';
                    hidden_input_key.value = check_obj.check_key;
                    hidden_input_key.type = 'hidden';
                    //将二次验证口令赋值到隐藏域
                    this_form.appendChild(hidden_input_key);
  					var hidden_input_address = document.createElement('input');
					hidden_input_address.name = 'check_address';
                    
					hidden_input_address.value = check_obj.check_address;
                    hidden_input_address.type = 'hidden';
                    //将二次验证地址赋值到隐藏域
                    this_form.appendChild(hidden_input_address);
                    //再次执行 tou_submit 函数
                    this_form.submit();

                },
                onError: function (args)
                {
                    //启用备用方案
                }
            });
            return false;
        }
    }
  </script> 
 </body>
</html>